﻿Public Partial Class frm_PortScheduler
    Inherits System.Web.UI.Page
    Dim clsGet As New ClassFunctionGetData()
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            ' Dynamic ในส่วนของเรือ
            'Dim html As String = "<ul id='gallery' >"
            'For i = 0 To 20
            '    html &= "<li><h5>Vessel" & i.ToString() & "</h5><img src='../Image/vessel.gif' id='a" & i.ToString() & "'   alt='kun' width='96' height='72' //></li>"
            'Next
            'html &= "</ul>"
            'Drag.Text = html
            Dim ds As DataSet = clsGet.Get_Booking_Wharf("20100901", "20100923", "B")
            Dim dsQueue As DataSet = clsGet.Get_Booking_WharfQueue("20090901", "20110923", "")

            Dim html As String = "<ul id='gallery' >"
            For Each dr As DataRow In ds.Tables(0).Rows
                Dim Dateshow As String = dr.Item("Date_From").ToString().Substring(0, 2) & "-" & dr.Item("Date_To")
                html &= "<li><h5>" & dr.Item("Vehicle_Text") & "</h5><img src='../Image/vessel.gif' id='" & dr.Item("Booking_no") & "' width='96' height='72' onmouseover=showtooltip('tooltip1','" & dr.Item("Customer_name").ToString().Replace(" ", "\xa0") & "','" & dr.Item("Agent_name").ToString().Replace(" ", "\xa0") & "','" & dr.Item("Vehicle_Text").ToString().Replace(" ", "\xa0") & "','" & dr.Item("Vehicle_LOA").ToString().Replace(" ", "\xa0") & "','" & dr.Item("Vehicle_DWT").ToString().Replace(" ", "\xa0") & "','" & dr.Item("Vehicle_Draft").ToString().Replace(" ", "\xa0") & "','" & dr.Item("Vehicle_GRT").ToString().Replace(" ", "\xa0") & "','" & Dateshow.Replace(" ", "\xa0") & "','" & dr.Item("Product_name").ToString().Replace(" ", "\xa0") & "','" & dr.Item("Product_Amount").ToString().Replace(" ", "\xa0") & "'); onmouseout=hidetooltip('tooltip1'); //></li>"
            Next
            html &= "</ul>"

            Drag.Text = html


            ' Dynamaic ในส่วนของ วาร์ป
            Dim html2 As String = "<div id='trash' style='height:177px;width:302px;border: 1px solid #000000;overflow:auto;position:relative; left:0px; top:0px; ' ><span>จำนวนเรือที่รอเข้าเทียบท่า " & dsQueue.Tables(0).Rows.Count & " ลำ</span><br />"
            'ทำการ bind ค่าเรือที่ถูกทำการจองก่อนหน้า
            For Each dr As DataRow In dsQueue.Tables(0).Rows
                Dim Dateshow As String = dr.Item("Date_From").ToString().Substring(0, 2) & "-" & dr.Item("Date_To")
                Select Case dr.Item("BookingWharf")
                    Case "00001"
                        html2 &= "<img src='../Image/vessel.gif' id='" & dr.Item("Booking_no") & "' width='44' height='33' onmouseover=showtooltip('tooltip1','" & dr.Item("Customer_name").ToString().Replace(" ", "\xa0") & "','" & dr.Item("Agent_name").ToString().Replace(" ", "\xa0") & "','" & dr.Item("Vehicle_Text").ToString().Replace(" ", "\xa0") & "','" & dr.Item("Vehicle_LOA").ToString().Replace(" ", "\xa0") & "','" & dr.Item("Vehicle_DWT").ToString().Replace(" ", "\xa0") & "','" & dr.Item("Vehicle_Draft").ToString().Replace(" ", "\xa0") & "','" & dr.Item("Vehicle_GRT").ToString().Replace(" ", "\xa0") & "','" & Dateshow.Replace(" ", "\xa0") & "','" & dr.Item("Product_name").ToString().Replace(" ", "\xa0") & "','" & dr.Item("Product_Amount").ToString().Replace(" ", "\xa0") & "'); onmouseout=hidetooltip('tooltip1'); />"
                End Select
            Next
            html2 &= "<br /><span>จำนวนเรือที่จัดคิวเข้าเทียบท่าล่าสุด  </span><span id='txtNumber'>0</span><span> ลำ</span>"
            html2 &= "</div>"

            'html2 &= "<div id='trash2' style='height:177px;width:302px;border: 1px solid #000000;overflow:auto;position:relative; left:305px; top:0px;' ><span>จำนวนเรือที่รอเข้าเทียบท่า " & dsQueue.Tables(0).Rows.Count & " ลำ</span><br />"
            ''ทำการ bind ค่าเรือที่ถูกทำการจองก่อนหน้า
            'For Each dr As DataRow In dsQueue.Tables(0).Rows
            '    Select Case dr.Item("BookingWharf")
            '        Case "00001"
            '            html2 &= "<img src='../Image/vessel.gif' id='" & dr.Item("Booking_no") & "' width='44' height='33' onmouseover=showtooltip('tooltip1','" & dr.Item("Vehicle_Text").ToString().Replace(" ", "\xa0") & "'); onmouseout=hidetooltip('tooltip1'); />"
            '    End Select
            'Next
            'html2 &= "<br /><span>จำนวนเรือที่จัดคิวเข้าเทียบท่าล่าสุด  </span><span id='txtNumber'>0</span><span> ลำ</span>"
            'html2 &= "</div>"
            LiTrash.Text = html2
        End If
    End Sub

    Private Sub MainPage_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
        Dim ds As DataSet = Session("UserData")
        If Not (ds Is Nothing) Then
            Page.MasterPageFile = clsGet.GetMaster_Page(ds.Tables(0).Rows(0).Item("User_Name").ToString(), "M")
        End If
    End Sub
End Class